fix: respect 'use no memo' directive in react-compiler-no-manual-memoization rule - #1750
Merged
Conversation
…ization rule When a component has the 'use no memo' directive, React Compiler skips optimization for that component, so manual memoization (useMemo, useCallback, memo) is still needed. This change adds support for detecting the 'use no memo' directive and suppresses the react-compiler-no-manual-memoization rule in those cases. - Add hasUseNoMemoDirective utility function - Update rule to check for directive in enclosing function (useMemo/useCallback) - Update rule to check for directive in wrapped component (memo) - Add comprehensive tests including regression tests Fixes #1749 Co-authored-by: Skosh <skoshx@users.noreply.github.com>
Co-authored-by: Skosh <skoshx@users.noreply.github.com>
commit: |
Contributor
Interactive terminal E2ETerminal Control verified the built CLI at
|
aidenybai
marked this pull request as ready for review
September 5, 2026 09:02
This was referenced Sep 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
React Compiler skips functions or modules with an opt-out directive. The rule still reported their manual memoization as redundant.
Before: manual memoization under
"use no memo"could produce a warning.After: function and module opt-outs preserve manual memoization while normal compiled code still reports it.
What changed
"use no memo"and the"use no forget"alias.memo.Local RDE did not run because its checkout contains unrelated user changes. Daytona parity did not run because
DAYTONA_API_KEYis not available in this environment.Test plan
Fixes #1749